package com.cheng.controller;

import com.cheng.common.exception.CommonException;
import com.cheng.common.results.DataRslt;
import com.cheng.data.vo.AcceptInfoVO;
import com.cheng.data.vo.ReqPageInfoVO;
import com.cheng.data.vo.RespPageInfoVO;
import com.cheng.operation.AcceptInfoOperation;
import com.cheng.operation.CompanyInfoOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: ChengJW
 * @date: 2021/11/25 7:42
 * @version: 1.0
 * @description: 档案搜索页面
 */
@Controller
public class ArchivesQueryController extends BaseController{

    private final static Logger log = LoggerFactory.getLogger(ArchivesQueryController.class);

    @Autowired
    private CompanyInfoOperation companyInfoOperation;
    @Autowired
    private AcceptInfoOperation acceptInfoOperation;

    @RequestMapping({"/business/archivesSearch","/circulation/archivesSearch","/archivesKuFang/archivesSearch"})
    public String archivesQuery(){
        return "archivesQuery";
    }

    @RequestMapping("/business/archivesSearch/showAceptInfo")
    public String showAceptInfo(){
        return "showAceptInfo";
    }

    /**
     * @author: ChengJW
     * @params: []
     * @return: com.cheng.common.results.DataRslt
     * @date: 2021/11/26
     * @description: 查询档案信息
     */
    @RequestMapping("/business/acceptAdmin/queryCompanyInfo")
    @ResponseBody
    public DataRslt queryCompanyInfo(ReqPageInfoVO pageInfoVO) throws CommonException{

        pageInfoVO.setUserCode(getUrCode());
        RespPageInfoVO respPageInfoVO = companyInfoOperation.queryCompanyInfoVOList(pageInfoVO);
        if (respPageInfoVO != null){
            return tabSuccess(respPageInfoVO);
        }
        return tabFailure();
    }

    /**
    * @author: ChengJW
    * @params: [vo]
    * @return: com.cheng.common.results.DataRslt
    * @date: 2021/11/30
    * @description: 反显受理信息
    */
    @RequestMapping("/business/archivesSearch/initAceptInfo")
    @ResponseBody
    public DataRslt initShowAceptInfo(AcceptInfoVO vo) throws CommonException {
        return success(acceptInfoOperation.queryAcceptInfoVO(vo));
    }
}
